<template>
  <a-table
    rowKey="id"
    class="wearing-table"
    :columns="callLogColumns"
    :dataSource="dataSource"
    @change="handleTableChange"
  >
    <template slot="action" slot-scope="records">
      <span class="operation deatil-color" @click="handleChange(records)">更换</span>
    </template>
  </a-table>
</template>

<script>
import { JeecgListMixinNew } from '@/mixins/JeecgListMixinNew'
import { previewImage } from '@/utils/util'

export default {
  mixins: [JeecgListMixinNew],
  data() {
    return {
      url: {
        list: '/wb/mentalpatient/medicineRecordPage',
      },
      callLogColumns: [
        {
          title: '序号',
          align: 'center',
          width: 100,
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '吃药时间',
          align: 'center',
          dataIndex: 'helpTime',
          ellipsis: true,
        },
        {
          title: '药品名称',
          align: 'center',
          dataIndex: 'medicineName',
          ellipsis: true,
        },
        {
          title: '吃药地点',
          align: 'center',
          dataIndex: 'helpAddress',
          ellipsis: true,
        },
        {
          title: '照片',
          align: 'center',
          dataIndex: 'medicinePic',
          ellipsis: true,
          customRender: (t) => {
            return t ? (
              <span
                class="deatil-color"
                onClick={() => {
                  previewImage.call(this, [t])
                }}
              >
                查看
              </span>
            ) : (
              '暂无'
            )
          },
        },
        {
          title: '上报人',
          align: 'center',
          dataIndex: 'helpName',
          ellipsis: true,
        },
        {
          title: '上报时间',
          align: 'center',
          dataIndex: 'createTime',
          ellipsis: true,
        },
      ],
      disableMixinCreated: true,
    }
  },
  method: {
    handleChange() {},
    lookViewImage() {
      console.log('hihi')
      previewImage.call(this, urls)
    },
  },
  mounted() {
    this.extendParams = {
      id: this.$route.query.id,
    }
    this.loadData(1)
  },
}
</script>
